const fs = require('fs')
module.exports = {
    analysisNginxLog() {
        const listFile = fs.readdirSync(this.app.config.nginxLogDir)
        console.log(listFile)
        
        return {
            access: listFile.filter(vv => vv.indexOf('access') > -1),
            error: listFile.filter(vv => vv.indexOf('error') > -1)
        }
    },
    analysisNginxLogFile(filename) {
        if (!filename) {
            return {}
        }
        const fileContent = fs.readFileSync(`${this.app.config.nginxLogDir}${filename}`).toString().split("\n")
        return {
            fileContent
        }
    }
}